package com.xiaoxie.boot.service.impl;

import com.xiaoxie.boot.bean.Role;
import com.xiaoxie.boot.bean.RoleMenuInfo;
import com.xiaoxie.boot.dao.UtilMapper;
import com.xiaoxie.boot.service.UtilService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xiaoxie
 * @create 2022-03-28 13:40
 */
@Service
public class UtilServiceImpl implements UtilService {

    @Autowired
    private UtilMapper utilMapper;

    @Override
    public int addUserRole(Integer userId, Integer roleId) {
        int i = utilMapper.addUserRole(userId, roleId);
        return i;
    }

    @Override
    public int addRoleMenu(Integer roleId, Integer menuId) {
        int i = utilMapper.addRoleMenu(roleId, menuId);
        return i;
    }

    @Override
    public List<Integer> selectRoleMenu(Integer id) {
        List<Integer> integers = utilMapper.selectRoleMenu(id);
        return integers;
    }

    @Override
    public int deleteByRoleId(Integer id) {
        int i = utilMapper.deleteByRoleId(id);
        return i;
    }

    @Override
    public List<Role> selectAllRole() {
        List<Role> roles = utilMapper.selectAllRole();
        return roles;
    }

    @Override
    public int deleteByUserId(Integer id) {
        int i = utilMapper.deleteByUserId(id);
        return i;
    }
}
